#include <iostream>
#include <string.h>
#include <stdio.h>

using namespace std;

int main()
{
	int ncases;
	string line;

	int i;
	int index;

	float number[2];

	char concept[2];

	char unit[2];
	
	cin>>ncases;

	while(ncases--)
	{
		index = -1;

		getline(cin, line, '\n');
		
		i = -1;
		i = line.find("U=", 0);
	
		if(i >= 0 && i < line.length())
		{
			index++;
			unit[index] = 1;
			if(line[i+2] >= '0' && line[i+2] <= '9')
				for(int j = i + 3; j < line.length(); j++)
				{
					if(!(line[j] >= '0' && line[j] <= '9'))
					{
						sscanf((line.substr( i+2, j-(i+2) )).c_str(), "%f", &(number[index]));
						cout<<number[index]<<endl;

						if(line[i+2 + j-(i+2) + 1] == ' ')
							unit[index] = line[i+2 + j-(i+2)];
						else if(line[i+2 + j-(i+2) + 2] == ' ')
							unit[index] = line[i+2 + j-(i+2) + 1];
						cout<<unit[index]<<endl;
							

						break;
					}
				}
		}

		i = -1;
		i = line.find("P=", 0);
	
		if(i >= 0 && i < line.length())
		{
			index++;
			unit[index] = 1;
			for(int j = i + 3; j < line.length(); j++)
			{
				if( (line[j] >= '0' && line[j] <= '9') )
				{
					cout<<(line.substr( i+2, j-(i+2) )).c_str()<<endl;

					sscanf((line.substr( i+2, j-(i+2) )).c_str(), "%f", &(number[index]));

					//cout<<number[index]<<endl;

					if(line[i+2 + j-(i+2) + 1] == ' ' || line[i+2 + j-(i+2) + 1] == '.' || line[i+2 + j-(i+2) + 1] == ',')
						unit[index] = line[i+2 + j-(i+2)];
					else if(line[i+2 + j-(i+2) + 2] == ' ' || line[i+2 + j-(i+2) + 2] == '.' || line[i+2 + j-(i+2) + 2] == ',')
						unit[index] = line[i+2 + j-(i+2) + 1];
					
//cout<<unit[index]<<endl;
						
					break;
				}
			}
		}

		i = -1;
		i = line.find("I=", 0);
	
		if(i >= 0 && i < line.length())
		{
			index++;
			unit[index] = 1;
			if(line[i+2] >= '0' && line[i+2] <= '9')
				for(int j = i + 3; j < line.length(); j++)
				{
					if(!(line[j] >= '0' && line[j] <= '9'))
					{
						sscanf((line.substr( i+2, j-(i+2) )).c_str(), "%f", &(number[index]));
						cout<<number[index]<<endl;

						if(line[i+2 + j-(i+2) + 1] == ' ')
							unit[index] = line[i+2 + j-(i+2)];
						else if(line[i+2 + j-(i+2) + 2] == ' ')
							unit[index] = line[i+2 + j-(i+2) + 1];
						cout<<unit[index]<<endl;
							

						break;
					}
				}
		}
	}

	return 0;
}
